const columns = reactive([
  {
    title: getProxyT("base.index"),
    dataIndex: "index",
    key: "index",
  },
  {
    title: getProxyT("table44"),
    dataIndex: "index",
    key: "index",
  },
  {
    title: getProxyT("table23"),
    dataIndex: "index",
    key: "index",
  },
  {
    title: getProxyT("table234"),
    dataIndex: "index",
    key: "index",
  },
  {
    title: getProxyT("table235"),
    dataIndex: "index",
    key: "index",
  },
  {
    title: getProxyT("table236"),
    dataIndex: "index",
    key: "index",
  },
  {
    title: computed(() => `${$t("table237")}IP`),
    dataIndex: "index",
    key: "index",
  },
  {
    title: getProxyT("table238"),
    dataIndex: "index",
    key: "index",
  },
  {
    title: getProxyT("base.action"),
    key: "action",
  },
]);
export const tablePage = renderTablePage();
export const tableData = ref([{}]);
export const tableLoading = ref(false);
const defineBodyCellMap = ({ value, text, index, column, record }) => {
  return new Map([[{ key: "index" }, renderIndex]]);
};
const handleRenderBodyCellTask = (props) => {
  const array = [...defineBodyCellMap(props)].filter(
    ([object]) => object.key === props.column.key
  );
  const _this = { tablePage, ...props };
  return array.map(([, value]) => value.call(_this));
};
export const tableConfig = () => {
  const defineTable = {
    pagination: tablePage,
    columns,
    dataSource: tableData,
    loading: tableLoading,
    on: {
      change(paging: { current: number; pageSize: number }) {
        tablePage.current = paging.current;
        tablePage.pageSize = paging.pageSize;
        // fetchList();
      },
    },
    tableSlot: {
      bodyCell: (props) => handleRenderBodyCellTask(props),
    },
  };
  return defineTable;
};
